package cn.wingware.util;

import java.util.Calendar;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Logger;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

/**
 * 
 * @author Administrator
 *  日志拦截器
 *  /所有controller类被调用之前都要做获取访问者ip地址的日志输出/
 */
public class LogInterceptor extends HandlerInterceptorAdapter {
	
	private static final Log log = LogFactory.getLog(LogInterceptor.class);
	
	
	public boolean preHandle(HttpServletRequest request,HttpServletResponse response,Object handler) throws Exception {
			CommonUtils util = null;
			String ip = util.getIpAddr(request);
			log.info("<======== visitor ip address is :"+ip+" =========>");
			return true;
			
    }
}
